import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../resource/ImagesConst";
import { BaseItem } from "../common/BaseItem";
import { ObjCreate } from "../common/ObjCreate";
import { GBox } from "../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ItemData } from "../../resource/info/ItemData";
import { Language } from "../../../../extend/language/Language";
import { DegreeRewardIndexItem } from "../daily/reward/DegreeRewardIndexItem";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class HuntRewardDetailBox
    
    export  class HuntRewardDetailBox /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._itemBorder = ResouceConst.getScaleBitmap(ImagesConst.PackItemBg);
            this._itemBorder.setSize(38, 38);
            addChild(this._itemBorder);
            this._baseItem = new BaseItem();
            this._baseItem.x = this._itemBorder.x + 3;
            this._baseItem.y = this._itemBorder.y + 3;
            this._baseItem.setSize(32, 32);
            addChild(this._baseItem);
            this._itemName = ObjCreate.createTextField("", this._baseItem.x + this._baseItem.width + 10, this._baseItem.y, 250, 20, this);
            this._itemBox = new GBox();
            this._itemBox.x = this._itemName.x + 5;
            this._itemBox.y = this._itemName.y + 20;
            this._itemBox.direction = GBoxDirection.HORIZONTAL;
            this._itemBox.horizontalGap = 4;
            addChild(this._itemBox);
            this._itemExTxt = ObjCreate.createTextField("...", 350, 30, 60, 20, this);
            this._itemExTxt.htmlText = "<font size=\'15\'>" + HTMLUtil.addColor("...", GlobalStyle.color1) + "</font>";
            this._itemExTxt.mouseEnabled = false;
            this._line = ResouceConst.getScaleBitmap(ImagesConst.Line);
            this._line.width = 370;
            this._line.x = 10;
            this._line.y = 65;
            addChild(this._line);
            return;
        }

        public updateData(arg1: int, arg2: Array<any>, arg3: string): void
        {
            var loc1=0;
            var loc3=null;
            var loc4=null;
            this._itemData = new ItemData(arg1);
            this._baseItem.itemData = this._itemData;
            this._itemName.htmlText = this._itemData.htmlName + "  " + HTMLUtil.addColor(arg3 + Language.getString(22033), "#00ff00");
            while (this._itemBox.numChildren > 0) 
            {
                this._itemBox.removeChildAt(0);
            }
            var loc2=arg2.length;
            while (loc1 < loc2) 
            {
                if ((loc4 = new ItemData(int(arg2[loc1]))).itemInfo) 
                {
                    (loc3 = new DegreeRewardIndexItem()).updateData(loc4);
                    this._itemBox.addChild(loc3);
                }
                ++loc1;
            }
            this._itemBox.invalidate();
            return;
        }

        public /* override */ get height(): number
        {
            return 68;
        }

        /* internal */ /* var */_itemBorder: ScaleBitmap;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_itemName: Object /* flash.text.TextField */;

        /* internal */ /* var */_itemBox: GBox;

        /* internal */ /* var */_itemExTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_line: ScaleBitmap;
    }
